<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>IupColorDlg</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
<style type="text/css">
.style1 {
	border-width: 0;
}
.style2 {
	color: #FF0000;
}
</style>
</head>
<body>
<div id="navigation">
  <ul>
    <li><a href="#Creation">Creation</a></li>
    <li><a href="#Attributes">Attributes</a></li>
    <li><a href="#Callbacks">Callbacks</a></li>
    <li><a href="#Notes">Notes</a></li>
    <li><a href="#Examples">Examples</a></li>
    <li><a href="#SeeAlso">See Also</a></li>
  </ul>
</div>

<h2>IupColorDlg<font size="4"> (since 3.0)</font></h2>
<p>Creates the Color Dialog element. It is a predefined dialog for 
  selecting a color. </p>
<p>(since IUP version 3.24 the native versions were removed and only the <strong>IupColorBrowser</strong> 
based dialog remains.)</p>
<h3><a name="Creation">Creation</a></h3>
<pre>Ihandle* IupColorDlg(void); [in C]
iup.colordlg{} -&gt; (<strong>elem</strong>: ihandle) [in Lua]
colordlg() [in LED]</pre>
<p><u>Returns:</u> the identifier of the 
  created element, or NULL if an error occurs.</p>

<h3><a name="Attributes">Attributes</a></h3>
<p>Supports all the <a href="iupdialog.html#Attributes">IupDialog</a> attributes 
and the following additional attributes:</p>
<p><b>ALPHA</b>: if defined it will enable an alpha selection 
additional 
controls with its initial value. If the user pressed the Ok button contains the 
returned value. Default: no defined, or 255 if SHOWALPHA=YES.</p>
<p><b>COLORTABLE</b>: list of colors separated by &quot;;&quot;. If a color is not specified then the default color is 
used. You can skip colors using &quot;;;&quot;. The maximum number of colors is 
20.</p>
<p><a href="../attrib/iup_parentdialog.html">PARENTDIALOG</a>
  (creation only): Name of a dialog to be used as parent. This dialog will 
  be always in front of the parent dialog.</p>
<p><strong>SHOWALPHA</strong>: if enabled will 
display the alpha selection controls, regardless if ALPHA is defined for the 
initial value or not. </p>
<p><strong>SHOW</strong><b>COLORTABLE</b>: if enabled will display the color 
table, regardless if <b>COLORTABLE</b> is defined or not. </p>
<p><strong>SHOWHEX</strong>: if enabled will display the 
Hexadecimal notation of the color.</p>
<p><strong>SHOWHELP</strong>: if enabled will display the 
Help button. The Help button is shown only if the HELP_CB 
callback is defined.</p>
<p><b>STATUS</b> (read-only): defined to &quot;1&quot; if the user pressed the Ok button, NULL if 
pressed the Cancel button.</p>
<p><a href="../attrib/iup_title.html">TITLE</a>:
  Dialog title.</p>
<p><strong>VALUE</strong>: The color value in RGB coordinates and 
optionally alpha. It is 
used as the initial value and contains the selected 
value if the user pressed the Ok button. Format: &quot;R G B&quot; or &quot;R G B A&quot;. Each 
component range from 0 to 255.</p>
<p><strong>VALUEHSI</strong>: The color value in 
HSI coordinates. It is used as the initial value and contains the selected 
value if the user pressed the Ok button. Format: &quot;H S I&quot;. Each 
component range from 0-359, 0-100 and 0-100 respectively.</p>
<p><strong>VALUEHEX</strong>: The color value in 
RGB Hexadecimal notation. It is used as the initial value and contains the selected 
value if the user pressed the Ok button. Format: &quot;#RRGGBB&quot;. Each 
component range from 0-255, but in hexadecimal notation.</p>
<h3><a name="Callbacks">Callbacks</a></h3>
<p>Supports all the <a href="iupdialog.html#Callbacks">IupDialog</a> callbacks 
and the following additional callbacks:</p>
<p><strong>COLORUPDATE_CB</strong>: Action generated when the color is updated 
in the dialog. It is also called when the color is updated programmatically. 
(since 3.11)</p>
<pre>int function(Ihandle* <b>ih</b>);  [in C]<strong>
elem</strong>:colorupdate_cb() -&gt; (<strong>ret</strong>: number) [in Lua]</pre>
<p class="info"><strong>ih</strong>:
  identifier of the element that activated the 
  event.</p>

<p><a href="../call/iup_help_cb.html">HELP_CB</a>: Action generated when the 
Help button is pressed.</p>
<h3><a name="Notes">Notes</a></h3>
<p>It is a regular <strong>IupDialog</strong> that can be shown with
<a href="../func/iupshow.html">IupShow</a> or 
<a href="../func/iuppopup.html">IupPopup</a>. (since 3.24)</p>
<h3><a name="Examples">Examples</a></h3>
<pre>Ihandle* dlg = IupColorDlg();

IupSetAttribute(dlg, "VALUE", "128 0 255");
IupSetAttribute(dlg, "ALPHA", "142");
IupSetAttribute(dlg, "SHOWHEX", "YES");
IupSetAttribute(dlg, "SHOWCOLORTABLE", "YES");
IupSetAttribute(dlg, "TITLE", "IupColorDlg Test");
IupSetCallback(dlg, "HELP_CB", (Icallback)help_cb);

IupPopup(dlg, IUP_CURRENT, IUP_CURRENT);

if (IupGetInt(dlg, "STATUS"))
{
  printf("OK\n");
  printf("  COLOR(%s)\n", IupGetAttribute(dlg, "COLOR"));
  printf("  COLORTABLE(%s)\n", IupGetAttribute(dlg, "COLORTABLE"));
}
else
  printf("CANCEL\n");

IupDestroy(dlg);  </pre>
<div align="center">
  <center>
  <table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1">
    <tr>
      <td class="style1"><img border="0" src="images/colordlg_cb.png"></td>
    </tr>
  </table>
  </center>
</div>
<h3><a name="SeeAlso">See Also</a></h3>
<p><a href="iupmessagedlg.html">IupMessageDlg</a>, 
<a href="iupgetfiledlg.html">IupFileDlg</a>, 
<a href="../func/iuppopup.html">IupPopup</a></p>

</body>

</html>